package com.right.health.app.dialog;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;

import com.right.health.app.R;

/*
 * Created by hopeliao on 2019-11-23
 *
 */
public class CycleTimeBottomDialog extends ListBottomSheetDialog implements View.OnClickListener {
    private OnConfirmListener mConfirmListener;

    public void setConfirmListener(OnConfirmListener listener) {
        this.mConfirmListener = listener;
    }

    public CycleTimeBottomDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getContentViewId() {
        return R.layout.dialog_cycle_time_bottom;
    }

    @Override
    protected void findViews() {
        super.findViews();
        findViewById(R.id.tv_cancel).setOnClickListener(this);
        findViewById(R.id.view_placeholder).setOnClickListener(this);
        findViewById(R.id.tv_yes).setOnClickListener(this);
    }


    @Override
    public void onClick(View v) {
        if(R.id.view_placeholder == v.getId() || R.id.tv_cancel == v.getId()) {
            dismiss();
        } else if(R.id.tv_yes == v.getId()) {
            if(mConfirmListener != null) {
                mConfirmListener.onConfirm(mTag);
            }
        }
    }

    public interface OnConfirmListener {
        void onConfirm(Object tag);
    }
}
